/**
 * Created by wxy on 2017/10/13.
 */
;(function () {

    angular.module('xiaohu', [
        'ui.router',
        'common',
        'user',
        'question',
        'answer'
    ])
        .config([
            '$interpolateProvider',
            '$stateProvider',
            '$urlRouterProvider',
            function ($interpolateProvider, $stateProvider, $urlRouterProvider) {
                $interpolateProvider.startSymbol('[:');
                $interpolateProvider.endSymbol(':]');

                $urlRouterProvider.otherwise('/home');

                $stateProvider
                    .state('home', {
                        url: '/home',
                        templateUrl: '/laravel54/public/index.php/tpl/page/home'
                    })
                    .state('signup', {
                        url: '/signup',
                        templateUrl: '/laravel54/public/index.php/tpl/page/signup'
                    })
                    .state('login', {
                        url: '/login',
                        templateUrl: '/laravel54/public/index.php/tpl/page/login'
                    })
                    .state('question', {
                        url: '/question',
                        abstract: true,
                        template: '<div ui-view=""></div>'
                        //,controller: 'QuestionController'

                    })
                    .state('question.detail', {
                        url: '/detail/:id?answer_id',
                        templateUrl: '/laravel54/public/index.php/tpl/page/question_detail'
                    })
                    .state('question.add', {
                        url: '/add',
                        templateUrl: '/laravel54/public/index.php/tpl/page/question_add'
                    })
                    .state('user', {
                        url: '/user/:id',
                        templateUrl: '/laravel54/public/index.php/tpl/page/user'
                    })
                // .state('question.add', {
                //     url: '/add',
                //     templateUrl: 'question.add.tpl'
                // })

            }])
        .controller('BaseController', [
            '$scope',
            function ($scope) {

                $scope.his = {
                    id: parseInt($('body').attr('user-id'))
                };
            }
        ])

})();